package com.example.usermanager.config;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:咭咭熊
 * Date:2021 - 08 - 01
 * Time:7:54
 */

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/***
 * 系统拦截器——使用@Configuration注解标识
 */
@Configuration
public class AppConfig implements WebMvcConfigurer {
    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //1.设置拦截规则（拦截权限）
        registry.addInterceptor(new LoginIntercepter())
                .addPathPatterns("/**")//拦截所有路径/**
                .excludePathPatterns("/js/**.js")//排除
                .excludePathPatterns("/images/**")
                .excludePathPatterns("/css/**.css")
                .excludePathPatterns("/fonts/**")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/user/login");
        //拦截路由



    }
}
